<!DOCTYPE html><html lang="zh-CN"><head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>longDateFormat | Moment.js &#x6587;&#x6863;</title>
  <link rel="stylesheet" href="static/css/style.css">
  <link rel="shortcut icon" href="http://momentjs.cn/static/img/moment-favicon.png">
  <link rel="stylesheet" href="static/css/atom-one-light.min.css">
</head>
<body class="is-moment">
  <div class="hero hero-oneline">
    <div class="hero-centered">
      <h1>longDateFormat</h1>
    </div>
  </div>
  <div id="api-section-__FILENAME__">
    <div id="content" class="clearfix">
  
      <div id="column1" data-id="__ID__" class="interior">
        <header>
          <!-- <h1>longDateFormat</h1> -->
          <div id="gtoc">
            <ul>
              <!-- <li>v</li> -->
              <li>
                <a href="index.html#/customization/long-date-formats/" name="toc">&#x8FD4;&#x56DE;&#x4E0A;&#x5C42;&#x6587;&#x6863;</a>
              </li>
              <li style="border: none;">
                <a href="javascript:window.open('https://github.com/momentjscn/moment-docs-cn/edit/master/moment/07-customization/06-long-date-formats.md');" rel="nofollow" target="_blank">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a>
              </li>
              <!-- <li>
                <a href="/search__SEARCH_PARAM__" name="toc">搜索</a>
              </li> -->
            </ul>
          </div>
          <hr>
        </header>

        <div id="biz_item"></div>
  
        <div id="apicontent">
          <div id="content_left">
							<div class="docs-method-signature">
								<pre><code class="language-js">// &#x4ECE; 2.12.0 &#x5F00;&#x59CB;
moment.updateLocale(&apos;en&apos;, {
    longDateFormat : Object
});

// &#x4ECE; 2.8.1 &#x81F3; 2.11.2
moment.locale(&apos;en&apos;, {
    longDateFormat : Object
});

// &#x5E9F;&#x5F03;&#x4E8E; 2.8.1
moment.lang(&apos;en&apos;, {
    longDateFormat : Object
});
</code></pre>

							</div>
<p><code>Locale#longDateFormat</code> &#x5E94;&#x662F;&#x4E00;&#x4E2A;&#x5305;&#x542B;&#x6BCF;&#x4E2A;&#x957F;&#x65E5;&#x671F;&#x683C;&#x5F0F; <code>L LL LLL LLLL LT LTS</code> &#x7684;&#x952E;/&#x503C;&#x5BF9;&#x7684;&#x5BF9;&#x8C61;&#x3002;
<code>LT</code> &#x5E94;&#x662F;&#x65F6;&#x95F4;&#x683C;&#x5F0F;&#xFF0C;&#x4E5F;&#x7528;&#x4E8E; <code>moment#calendar</code>&#x3002;</p>
<pre><code class="language-javascript">moment.updateLocale(&apos;en&apos;, {
    longDateFormat : {
        LT: &quot;h:mm A&quot;,
        LTS: &quot;h:mm:ss A&quot;,
        L: &quot;MM/DD/YYYY&quot;,
        l: &quot;M/D/YYYY&quot;,
        LL: &quot;MMMM Do YYYY&quot;,
        ll: &quot;MMM D YYYY&quot;,
        LLL: &quot;MMMM Do YYYY LT&quot;,
        lll: &quot;MMM D YYYY LT&quot;,
        LLLL: &quot;dddd, MMMM Do YYYY LT&quot;,
        llll: &quot;ddd, MMM D YYYY LT&quot;
    }
});
</code></pre>
<p>&#x53EF;&#x4EE5;&#x6392;&#x9664;&#x5C0F;&#x5199;&#x7684; <code>l</code> &#x4EE4;&#x724C;&#xFF0C;&#x5B83;&#x4EEC;&#x5C06;&#x4F1A;&#x901A;&#x8FC7;&#x4F7F;&#x7528;&#x77ED;&#x4EE4;&#x724C;&#x53D8;&#x4F53;&#x66FF;&#x6362;&#x957F;&#x4EE4;&#x724C;&#x800C;&#x81EA;&#x52A8;&#x521B;&#x5EFA;&#x3002;</p>
<pre><code class="language-javascript">moment.updateLocale(&apos;en&apos;, {
    longDateFormat : {
        LT: &quot;h:mm A&quot;,
        LTS: &quot;h:mm:ss A&quot;,
        L: &quot;MM/DD/YYYY&quot;,
        LL: &quot;MMMM Do YYYY&quot;,
        LLL: &quot;MMMM Do YYYY LT&quot;,
        LLLL: &quot;dddd, MMMM Do YYYY LT&quot;
    }
});
</code></pre>
					</div>
          <div id="content_right">
							<div class="docs-method-signature">
								<pre><code class="language-js">// From 2.12.0 onward
moment.updateLocale(&apos;en&apos;, {
    longDateFormat : Object
});

// From 2.8.1 to 2.11.2
moment.locale(&apos;en&apos;, {
    longDateFormat : Object
});

// Deprecated in 2.8.1
moment.lang(&apos;en&apos;, {
    longDateFormat : Object
});
</code></pre>

							</div>
<p><code>Locale#longDateFormat</code> should be an object containing a key/value pair for each long date format <code>L LL LLL LLLL LT LTS</code>. <code>LT</code> should be the time format, and is also used for <code>moment#calendar</code>.</p>
<pre><code class="language-javascript">moment.updateLocale(&apos;en&apos;, {
    longDateFormat : {
        LT: &quot;h:mm A&quot;,
        LTS: &quot;h:mm:ss A&quot;,
        L: &quot;MM/DD/YYYY&quot;,
        l: &quot;M/D/YYYY&quot;,
        LL: &quot;MMMM Do YYYY&quot;,
        ll: &quot;MMM D YYYY&quot;,
        LLL: &quot;MMMM Do YYYY LT&quot;,
        lll: &quot;MMM D YYYY LT&quot;,
        LLLL: &quot;dddd, MMMM Do YYYY LT&quot;,
        llll: &quot;ddd, MMM D YYYY LT&quot;
    }
});
</code></pre>
<p>You can eliminate the lowercase <code>l</code> tokens and they will be created automatically by replacing long tokens with the short token variants.</p>
<pre><code class="language-javascript">moment.updateLocale(&apos;en&apos;, {
    longDateFormat : {
        LT: &quot;h:mm A&quot;,
        LTS: &quot;h:mm:ss A&quot;,
        L: &quot;MM/DD/YYYY&quot;,
        LL: &quot;MMMM Do YYYY&quot;,
        LLL: &quot;MMMM Do YYYY LT&quot;,
        LLLL: &quot;dddd, MMMM Do YYYY LT&quot;
    }
});
</code></pre>
					</div>
          <div></div>
        </div>
      </div>
    </div>
  </div>
  
  <script src="static/js/highlight.min.js"></script>
  <script src="static/js/javascript.min.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>
  <script>var _hmt = _hmt || []; (function () { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?7a7f78c805fbacc7e075d34f153031aa"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();</script>

  <style>
    .hero-centered {
      margin: 0;
          margin-left: 10px;
    }
#gtoc ul {
  list-style: none;
  margin-left: 0;
  line-height: 1.5rem;
  padding: 0;
}
#gtoc>ul>li {
  display: inline;
  border-right: 1px solid #000;
  margin-right: .4rem;
  padding-right: .4rem;
}
#gtoc>ul>li>a {
  color: #61b2a7;
}
#content_left {
  width: 49%;float: left;border-right: 1px solid #eee;    padding-right: 2%;
}
#content_right {
float: left;width: 48%;margin-left: 3%;
}
#column1 {
  padding: 0 2rem;
}
  </style>


</body></html>